package com.jianneng.jdg.model.adapter;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.TextView;

import com.example.com.jianneng.jdg.R;
import com.jianneng.jdg.model.user.MyTeamInfo;

public class ReportMoneyDetailAdapter extends BaseAdapter {
	private Context mContext;
	private LayoutInflater mInflater;
	private List<MyTeamInfo> list = new ArrayList<MyTeamInfo>();

	public ReportMoneyDetailAdapter(Context mContext, List<MyTeamInfo> list) {
		this.mContext = mContext;
		this.list = list;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}


	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder2 mHolder2 = null;
		if (convertView == null) {
			mInflater = LayoutInflater.from(mContext);
				mHolder2 = new ViewHolder2();
				convertView = mInflater.inflate(
						R.layout.report_money_detail_content, parent, false);
				mHolder2.worker_name = (TextView) convertView
						.findViewById(R.id.worker_detail_name);
				mHolder2.payable_salary = (EditText) convertView
						.findViewById(R.id.payable_salary_item);
				mHolder2.actual_salary = (EditText) convertView
						.findViewById(R.id.actual_salary_item);
				convertView.setTag(mHolder2);
		} else {
				mHolder2 = (ViewHolder2) convertView.getTag();
		}
			// 设置资源
				MyTeamInfo info = list.get(position);
				mHolder2.worker_name.setText(info.worker_name);
				mHolder2.payable_salary.setText(info.payable_salary + "");
				mHolder2.actual_salary.setText(info.actual_salary + "");
				return convertView;
		}


	public class ViewHolder2 {
		TextView worker_name;
		EditText payable_salary;
		EditText actual_salary;
	}

}
